﻿<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>我收藏的职位-招聘服务-伯乐网</title>

    <link href="style/css/style.css" type="text/css" rel="stylesheet">
    <link href="style/css/external.min.css" type="text/css" rel="stylesheet">
    <link href="style/css/popup.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="style/js/jquery.1.10.1.min.js"></script>
    <script src="style/js/jquery.lib.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="style/js/ajaxfileupload.js"></script>
    <script src="style/js/additional-methods.js" type="text/javascript"></script>
    <!--layer.js-->
    <script type="text/javascript" src="style/js/layer/layer.js"></script>
</head>

<body>
<!--隐藏域 存放用户ID-->
<input type="hidden" id="userId" th:value="${session.user.id}">
<div id="body">
    <!--引入顶部导航栏-->
    <div id="header" th:fragment="common_top_nav">
        <div class="wrapper">
            <a href="/index" class="logo">
                <img src="style/images/logo.png" width="229" height="43" alt="伯乐网-专注互联网招聘"/>
            </a>
            <ul class="reset" id="navheader">
                <li>
                    <a href="/index">首页</a>
                </li>
                <li>
                    <a href="/companyList?page=1&size=9&companyName=&city=全国&stage=&field=" style="margin-left: 50px">搜索公司</a>
                </li>
                <li th:if="${session.user != null}" class="jianli">
                    <a href="javascript:void(0)" rel="nofollow" style="margin-left: 50px">我的简历</a>
                </li>
            </ul>
            <!--未登陆显示登陆注册-->
            <ul class="loginTop" th:if="${session.user}==null">
                <li>
                    <a href="/loginPage" rel="nofollow">登录</a>
                </li>
                <li>|</li>
                <li>
                    <a href="/registerPage" rel="nofollow">注册</a>
                </li>
            </ul>
            <!--已经登陆显示下拉列表-->
            <dl class="collapsible_menu" th:if="${session.user}!=null">
                <dt>
                    <span th:text="${session.user.phone}">路人甲</span>
                    <span class="red dn" id="noticeDot-0"></span>
                    <i></i>
                </dt>
                <dd class="jianli">
                    <a rel="nofollow" href="javascript:void(0)">我的简历</a>
                </dd>
                <dd id="collect">
                    <a th:href="'/selectCollections?userId='+${session.user.id}">我收藏的职位</a>
                </dd>
                <dd>
                    <a th:href="'/myToudi?userId='+${session.user.id}">我投递的职位 <span id="noticeNo" class="red dn">(0)</span></a>
                </dd>
                <dd>
                    <a href="/setting">帐号设置</a>
                </dd>
                <dd class="logout">
                    <a rel="nofollow" href="/logout">退出</a>
                </dd>
            </dl>
            <script>
                //前往简历页面
                $(".jianli").click(function () {
                    //获取当前用户ID
                    var userId=$("#userId").val();
                    location.href="/jianli?userId="+userId;
                });
            </script>
        </div>
    </div>
    <!--顶部导航栏 end-->
    <div id="container">

        <div class="clearfix">
            <div class="content_l">
                <dl class="c_collections">
                    <dt>
                        <h1><em></em>我收藏的职位</h1>
                    </dt>
                    <dd>
                        <form id="collectionsForm">
                            <ul class="reset my_collections" th:each="jobs : ${session.collectionPosition}">
                                <li>
                                    <a th:title="${jobs.companyInfo.id}" target="_blank" th:href="'/company?companyId='+${jobs.companyInfo.id}">
                                        <img th:alt="${jobs.companyInfo.companyName}" th:src="'companyLogo/'+${jobs.companyInfo.companyLogo}">
                                    </a>
                                    <div class="co_item">
                                        <h2 th:title="${jobs.position.positionName}">
                                            <a target="_blank" th:href="'/jobs?positionId='+${jobs.position.id}">
                                                <em>[[${jobs.position.positionName}]]</em>
                                                <span>（[[${jobs.position.leastSalary}]]K - [[${jobs.position.mostSalary}]]K）</span>
                                            </a>
                                        </h2>
                                        <span class="co_time">发布时间：[[${jobs.position.publishTime}]]</span>
                                        <div class="co_cate">[[${jobs.companyInfo.companyName}]] / [[${jobs.companyInfo.companyCity}]] / [[${jobs.position.workSuffer}]] / [[${jobs.position.education}]]</div>
                                        <span class="co_youhuo c7">[[${jobs.position.positionTempt}]]</span>
                                        <a class="collection_link" onclick="toudi(this)" href="javascript:void(0)">投个简历</a>
                                        <!--隐藏域 存放职位id-->
                                        <input type="hidden" th:value="${jobs.position.id}">

                                        <!--隐藏域 存放收藏id-->
                                        <input type="hidden" th:value="${jobs.collectId}">
                                        <a onclick="qxCollection(this)" class="collection_link" href="javascript:;">
                                            取消收藏
                                        </a>

                                    </div>
                                </li>
                                <script>
                                    //点击取消收藏按钮触发的事件
                                    function qxCollection(t) {
                                        //获取 取消的收藏id
                                        var collectId = $(t).prev().val().trim();
                                        //获取用户ID
                                        var userId=$("#userId").val().trim();
                                        location.href="cancle?collectId="+collectId+"&userId="+userId;
                                    }

                                    //点击投简历按钮触发事件
                                    function toudi(t) {
                                        //获取 职位id
                                        var positionId = $(t).next().val().trim();
                                        //获取用户ID
                                        var userId=$("#userId").val().trim();
                                        $.ajax({
                                            type: "post",
                                            url: "/toudi/" + userId+"/"+positionId,
                                            success: function (result) {
                                                //成功的回调函数
                                                if(result.code==-2){
                                                    //没有简历
                                                    layer.alert("您无可用的简历，请先添加简历信息",{icon: 2});
                                                    return false;
                                                }else if(result.code==-1){
                                                    //重读投递
                                                    layer.alert("该职位您已经投递过简历，请勿重复投递",{icon: 4});
                                                    return false;
                                                } else if (result.code == 0) {
                                                    //成功
                                                    layer.alert("投递成功！请关注简历投递的最新动态",{icon: 1});
                                                    return false;
                                                } else {
                                                    layer.alert("系统异常,请稍后再试！", {icon: 5});
                                                }
                                            }
                                        });

                                    }
                                </script>
                            </ul>
                        </form>
                    </dd>
                </dl>
            </div>
            <!--右侧边框-->
            <div class="content_r">
                <div class="mycenterR" id="myInfo">
                    <h2>我的信息</h2>
                    <a th:href="'/selectCollections?userId='+${session.user.id}">我收藏的职位</a>
                    <br>
                    <a target="_blank" th:href="'/myToudi?userId='+${session.user.id}">我投递的职位</a>
                </div>
                <!--二维码-->
                <div class="greybg qrcode mt20">
                    <img width="242" height="242" alt="这只是一个二维码" src="style/images/qr_resume.png">
                    <span class="c7">微信扫一扫，轻松找工作</span>
                </div>
            </div>
        </div>
        <script src="style/js/collections.min.js"></script>
        <script>
            $(function () {
                $('.Pagination').pager({
                    currPage: 1,
                    pageNOName: "pageNo",
                    form: "collectionsForm",
                    pageCount: 1,
                    pageSize: 5
                });
            });
        </script>
        <div class="clear"></div>
        <input type="hidden" value="4c6ae41d8c254f91becdb5f9ef2d4394" id="resubmitToken">
        <a rel="nofollow" title="回到顶部" id="backtop"></a>
    </div>
    <!-- end #container -->
</div>
<!-- end #body -->
<!--引入页面底部备案号-->
<div th:replace="public/publicFragment::footer_nav"></div>

<script src="style/js/core.min.js" type="text/javascript"></script>
<script src="style/js/popup.min.js" type="text/javascript"></script>

</body>

</html>